<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/docs.css" type="text/css" rel="stylesheet" />
<link href="../css/prettify.css" type="text/css" rel="stylesheet" />
<script src="../js/prettify.js" type="text/javascript"></script>
</head>
<body onLoad="prettyPrint()">
<div class="g-unit" id="doc-content">
<div id="api-info-block">
    <div class="api-level">H3C CAS云管理平台</div>
  </div>
  <div id="jd-header">
    <h1>备份虚拟机</h1>
  </div>
</div>
<div id="jd-content">
<div class="jd-descr">
<p>备份指定的虚拟机</p>
<h2><a name="uri"></a>接口 URI</h2>
<p>/cas/casrs/vm/backUp</p>
<h2><a name="access"></a>访问方法</h2>
<dl>
  <dt><b>HTTP 方法</b></dt>
  <dd>PUT</dd>
  <dt><b>消息体</b></dt>
   <p>1.主机本地目录备份</p>
  <div class="source">
  	<pre class="prettyprint lang-xml">&lt;vmBackUpParameter&gt;<br>  &lt;id&gt;30&lt;/id&gt;<br>  &lt;storeMode&gt;0&lt;/storeMode&gt;<br>  &lt;directory&gt;/vms&lt;/directory&gt;
  &lt;backupType&gt;0&lt;/backupType&gt;<br>  &lt;backupName&gt;aaa&lt;/backupName&gt;<br>  &lt;tmpDir&gt;/vms/vmbackuptmp&lt;/tmpDir&gt;<br>  &lt;keepTimes&gt;10&lt;/keepTimes&gt;<br>  &lt;isMd5Check&gt;0&lt;/isMd5Check&gt;<br>  &lt;isCompression&gt;0&lt;/isCompression&gt;<br>&lt;/vmBackUpParameter&gt;  </pre>
  </div>
  <p>2.远端服务器备份</p>
  <div class="source">
  	<pre class="prettyprint lang-xml">&lt;vmBackUpParameter&gt;<br>  &lt;id&gt;30&lt;/id&gt;<br>  &lt;storeMode&gt;1&lt;/storeMode&gt;<br>  &lt;directory&gt;/backup&lt;/directory&gt;<br>  &lt;targetAddr&gt;192.168.0.170&lt;/targetAddr&gt;<br>  &lt;userName&gt;jjun&lt;/userName&gt;<br>  &lt;password&gt;jjun&lt;/password&gt;<br>  &lt;type&gt;0&lt;/type&gt;
  &lt;backupType&gt;0&lt;/backupType&gt;<br>  &lt;backupName&gt;aaa&lt;/backupName&gt;<br>  &lt;tmpDir&gt;/vms/vmbackuptmp&lt;/tmpDir&gt;<br>  &lt;keepTimes&gt;10&lt;/keepTimes&gt;<br>  &lt;isMd5Check&gt;0&lt;/isMd5Check&gt;<br>  &lt;isCompression&gt;0&lt;/isCompression&gt;<br>&lt;/vmBackUpParameter&gt;</pre>
  </div>
</dl>

<dt><a name="detail"></a><b>元素含义</b></dt>
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">vmParamter</span>各子元素</th>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">id</span></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">需要备份的虚拟机 ID。必填项。</span>
            <div class="jd-descrdiv">长整数（long）类型。</div></td>
      </tr>
	  <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">storeMode</span></td>
        <td class="jd-linkcol"><span class="sympad">备份模式，0：主机本地目录，1：远端服务器。必填项。</span>
          <div class="jd-descrdiv">枚举(enum):0，1</div></td>
	  </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">directory</span></td>
        <td class="jd-linkcol"><span class="sympad">备份位置 。必填项。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
	  </tr>
	  <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">targetAddr</span></td>
        <td class="jd-linkcol"><span class="sympad">目的服务器IP地址。当备份模式为远端服务器时必填。</span>
          <DIV></DIV>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
	  </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">userName</span></td>
        <td class="jd-linkcol"><span class="sympad"> 目的服务器用户名。当备份模式为远端服务器时必填。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
	  </tr>
	  <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">password</span></td>
        <td class="jd-linkcol"><span class="sympad"></span>目的服务器密码。当备份模式为远端服务器时必填。
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">type</span></td>
        <td class="jd-linkcol">远端服务器类型，0：ftp方式，1：scp方式。当备份模式为远端服务器时必填。
          <div class="jd-descrdiv">枚举(enum):0，1。</div></td>
	  </tr>
	  <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">backupType</span></td>
        <td class="jd-linkcol"><span class="sympad"></span>备份类型
          ，0：全量备份，1：增量备份
          ，2：差异备份。必填项。
          <div class="jd-descrdiv">枚举(enum):0，1，2。</div></td>
    </tr>
    <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">backupName</span></td>
        <td class="jd-linkcol"><span class="sympad">备份文件名 。必填项。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
	  </tr>
	  <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">tmpDir</span></td>
        <td class="jd-linkcol"><span class="sympad">临时目录 。必填项。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
	  </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">keepTimes</span></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">保留个数。可选项。</span>
            <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
    <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">isMd5Check</span></td>
        <td class="jd-linkcol"><span class="sympad"></span>MD5校验
          ，0：不校验
          ，1：校验。可选项，默认不校验。
          <div class="jd-descrdiv">枚举(enum):0，1。</div></td>
    </tr>
    <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">isCompression</span></td>
        <td class="jd-linkcol"><span class="sympad"></span>压缩
          ，0：不压缩
          ，1：压缩。可选项，默认压缩。
          <div class="jd-descrdiv">枚举(enum):0，1。</div></td>
    </tr>
  </table>
<h2><a name="result"></a>返回结果</h2>
<dl>
  <dt><b>状态码</b></dt>
  <dd>
  <ul>
    <li>200(OK)：提交删除任务成功。</li>
  </ul>
  <ul>
    <li>409(Conflict)：失败。</li>
  </ul>
  </dd>
  <dt><b>消息头</b></dt>
  <div class="source">
    <pre class="prettyprint lang-xml">HTTP/1.1 200 OK<br>Server: Apache-Coyote/1.1<br>Set-Cookie: JSESSIONID=BDF7B4EDFDBA9FBF003D195F802D705F; Path=/imcrs<br>Date: Fri, 23 Dec 2011 04:44:21 GMT
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;taskMsg&gt;<br>  &lt;msgId&gt;1393831560400&lt;/msgId&gt;<br>  &lt;targetId&gt;3&lt;/targetId&gt;<br>  &lt;targetName&gt;vm110-1&lt;/targetName&gt;<br>  &lt;completed&gt;false&lt;/completed&gt;<br>  &lt;progress&gt;0&lt;/progress&gt;<br>  &lt;eventType&gt;0&lt;/eventType&gt;<br>&lt;/taskMsg&gt;</pre>
  </div>
</dl>

    <h2><a name="example"></a>应用举例</h2>
    <p>备份id为30的虚拟机，备份到主机本地目录。</p>
    <dl>
      <dt><b>请求</b></dt>
      <div class="source">
        <pre class="prettyprint lang-xml">PUT http://192.168.0.4:8080/cas/casrs/vm/backUp
accept: application/xml
&lt;vmBackUpParameter&gt;<br>  &lt;id&gt;30&lt;/id&gt;<br>  &lt;storeMode&gt;0&lt;/storeMode&gt;<br>  &lt;directory&gt;/vms&lt;/directory&gt;
  &lt;backupType&gt;0&lt;/backupType&gt;<br>  &lt;backupName&gt;aaa&lt;/backupName&gt;<br>  &lt;tmpDir&gt;/vms/vmbackuptmp&lt;/tmpDir&gt;<br>  &lt;keepTimes&gt;10&lt;/keepTimes&gt;<br>  &lt;isMd5Check&gt;0&lt;/isMd5Check&gt;<br>  &lt;isCompression&gt;0&lt;/isCompression&gt;<br>&lt;/vmBackUpParameter&gt;  
</pre>
      </div>
      <dt><b>回应</b></dt>
      <div class="source"><pre class="prettyprint lang-xml">HTTP/1.1 200 OK<br>Server: Apache-Coyote/1.1<br>Set-Cookie: JSESSIONID=BDF7B4EDFDBA9FBF003D195F802D705F; Path=/imcrs<br>Date: Fri, 23 Dec 2011 04:44:21 GMT
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;taskMsg&gt;<br>  &lt;msgId&gt;1393831560400&lt;/msgId&gt;<br>  &lt;targetId&gt;30&lt;/targetId&gt;<br>  &lt;targetName&gt;vm110-1&lt;/targetName&gt;<br>  &lt;completed&gt;false&lt;/completed&gt;<br>  &lt;progress&gt;0&lt;/progress&gt;<br>  &lt;eventType&gt;0&lt;/eventType&gt;<br>&lt;/taskMsg&gt;</pre>
      </div>
    </dl>
    
</div>
</div>
</div>
</body>
</html>